package com.xbxkj.api.web.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import com.xbxkj.commen.bean.layuiBean.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xbxkj.commen.controller.model.ResultModel;
import com.xbxkj.commen.bean.AdminPermission;
import java.util.HashMap;
import java.util.List;
    import com.xbxkj.commen.controller.helper.V;
    import com.xbxkj.commen.controller.helper.X;
    import com.xbxkj.commen.controller.model.ResultModel;

import java.util.Map;
    import com.xbxkj.commen.controller.BaseController;

/**
 * <p>
 * 菜单资源表 前端控制器
 * </p>
 *
 * @author 张子艺
 * @since 2020-01-09
 */
@Controller
@RequestMapping("/admin/adminPermission")
public class AdminPermissionController extends BaseController{
     /** 主页面 */
    @RequestMapping("main.html")
    public String main(){
       return  "AdminPermission/AdminPermissionMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "/addAdminPermissionHtml")
    public String addAdminPermissionHtml( ){
             return "AdminPermission/AdminPermissionAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "/editAdminPermissionHtml")
    public String editAdminPermissionHtml(String id ,Model model ){
           model.addAttribute("adminPermission",adminPermissionService.selectAdminPermissionByIdAdminPermission(id));
             return "AdminPermission/AdminPermissionEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "/showAdminPermissionHtml")
    public String showAdminPermissionHtml(String id ,Model model ){
           model.addAttribute("adminPermission",adminPermissionService.selectAdminPermissionByIdAdminPermission(id));
             return "AdminPermission/AdminPermissionShow";
    }


    /** 分页查询AdminPermission
     * @param page  页码
     * @param limit  查几条
     * @param adminPermission  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "/findAdminPermissionByPage")
    @ResponseBody
    public ResultPage findAdminPermissionByPage(Integer page, Integer limit,AdminPermission adminPermission){
             return adminPermissionService.findAdminPermissionByPage(page,limit,adminPermission);
    }

    /** 添加AdminPermission
     * @param adminPermission  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "/addAdminPermission")
    @ResponseBody
    public ResultModel<?> saveAdminPermission(AdminPermission adminPermission  ){
             return adminPermissionService.addAdminPermission(adminPermission);
    }

    /** 编辑AdminPermission
     * @param adminPermission  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "/editAdminPermission")
    @ResponseBody
    public ResultModel<?> editAdminPermission(AdminPermission adminPermission  ){
             return adminPermissionService.editAdminPermission(adminPermission);
    }



    /** 删除一条AdminPermission
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "/delAdminPermission")
    @ResponseBody
    public ResultModel<?> delAdminPermission( String id  ){
             return adminPermissionService.delAdminPermission(id);
    }


}
